import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Leetcode720 {
    public static void main(String[] args) {
        System.out.println("𠮷".length());
    }

    static {
        System.gc();
        System.runFinalization();
    }

    public static String longestWord(String[] words) {
        Arrays.sort(words, (w1, w2) -> w1.length() == w2.length() ? w2.compareTo(w1) : w1.length() - w2.length());

        Set<String> set = new HashSet<>();
        set.add("");

        String res = "";
        for (String word : words) {
            if (set.contains(word.substring(0, word.length() - 1))) {
                set.add(word);
                res = word;
            }
        }

        return res;
    }
}
